<title>Puzzle Admin - 授权管理</title>
<!-- ajax layout which only needs content area -->
<div class="page-header">
	<h1>
        <i class="glyphicon glyphicon-signal"></i>
        授权管理
	</h1>
</div><!-- /.page-header -->

<div id="gridview" class="gridview">
    <div class="grid-filter">
        <input type="text input-sm" class="txt" name="menuName" placeholder="菜单名称" />
    </div>

    <div class="grid-action" style="text-align: right">
        <a data-action="add" class="btn btn-action btn-primary btn-xs white"><i class="ace-icon fa fa-plus-circle"></i>新建</a>

        <a data-action="view" class=" btn btn-action btn-primary btn-xs"><i class="ace-icon fa fa-search-plus"></i>查看</a>

        <a data-action="delete" class=" btn btn-action btn-primary btn-xs"><i class="ace-icon fa fa-trash-o"></i>删除</a>

        <a data-action="refresh" class=" btn btn-action btn-primary btn-xs"><i class="ace-icon fa fa-refresh"></i>刷新</a>
    </div>

    <div class="grid-table">
        <table class="table table-striped table-bordered table-hover table-list table-tree">
            <thead>
            <tr>
                <th style="width:50px;">
                    <label class="position-relative">
                        <input type="checkbox" class="ace grid-cb-all" />
                        <span class="lbl"></span>
                    </label>
                </th>
                <th>编号</th>
                <th>授权类型</th>
                <th>授权对象</th>
                <th>授权内容</th>
                <th>授权内容类型</th>
                <th>操作</th>
            </tr>
            </thead>

            <tbody>
            <tr>
                <td colspan="8">
                    <div class='loading'><i class='ace-icon fa fa-spinner bigger-200 orange'></i><span class="text">正在加载</span></div>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="pagination-box">

        </div>
    </div>

    <!--save form-->
    <div class="grid-form save-form">
        <div class="overlay"></div>
        <div class="widget-box widget-color-blue light-border ui-sortable-handle" style="width:600px;height:400px;margin-left:-300px;margin-top:-200px">
            <div class="widget-header">
                <h5 class="widget-title smaller"></h5>

                <div class="widget-toolbar">
                    <a href="#" class="btn-action" data-action="hide">
                        <i class="ace-icon fa fa-close white"></i>
                    </a>
                </div>
            </div>

            <div class="widget-body">
                <div class="widget-main">
                    <div class="alert-info red"></div>
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">
                                授权类型
                            </label>

                            <div class="col-sm-9">
                                <input type="radio" class="ace" name="sourceType" value="1" />
                                <label class="lbl">按用户授权</label>

                                <input type="radio" class="ace" name="sourceType" checked="checked" value="2" />
                                <label class="lbl">按角色授权</label>

                                <input type="radio" class="ace" name="sourceType" value="3" />
                                <label class="lbl">按用户组授权</label>

                                <input type="radio" class="ace" name="sourceType" value="4" />
                                <label class="lbl">按部门授权</label>
                            </div>
                        </div>
                        <div class="form-group">

                        </div>
                        <div class="row">
                            <div class="col-xs-4 col-md-4">
                                <ul class="box-list">
                                    {{if $userList}}
                                    {{foreach from=$userList item=userItem key=index}}
                                    <li {{if $index eq 0}}class="selected"{{/if}}><a>{{$userItem.userName}}</a></li>
                                    {{/foreach}}
                                    {{else}}
                                    <li class="empty"><a>暂无用户数据</a></li>
                                    {{/if}}
                                </ul>
                            </div>

                            <div class="col-xs-4 col-md-4">
                                <ul class="tree-list"></ul>
                            </div>
                        </div>
                        <div class="clearfix form-actions">
                            <input type="hidden" name="sourceId" value="" />
                            <input type="hidden" name="targetId" value="" />
                            <a class="btn btn-sm btn-action" data-action="reset">
                                <i class="ace-icon fa fa-undo"></i>
                                重置
                            </a>
                            &nbsp; &nbsp; &nbsp;
                            <a class="btn btn-sm btn-primary btn-action" data-action="save">
                                <i class="ace-icon fa fa-check"></i>
                                提交
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- page specific plugin scripts -->
<script type="text/javascript">
    $('.page-content-area').ace_ajax('loadScripts', [null, null], function() {
        $("#gridview").gridview({
            url: "menu/list.do",
            pagination:{
                show: false
            },
            jsonReader:{
                key_field: "authorityId"
            },
            form:{
                url: "menu/action.do"
            },
            onLoadSuccess: function(data){

            },
            columns:[{
                name: "checkbox"
            },{
                name: "authorityId"
            },{
                name: "sourceId"
            },{
                name: "sourceType"
            },{
                name: "targetId"
            },{
                name: "targetType"
            },{
                name: "actions",
                list: ["delete", "view"]
            }]
        });
    });
</script>
